package com.qf.game;

/**
 * 双持武器
 */
public class DoubleweapenHero extends Hero{
    private Weapon otherWeapon;

    public Weapon getOtherWeapon() {
        return otherWeapon;
    }

    public void setOtherWeapon(Weapon otherWeapon) {
        this.otherWeapon = otherWeapon;
    }

    @Override
    public void attack() {
        super.attack();
        //使用副武器攻击
        if(otherWeapon!=null){
        int damage = otherWeapon.dealDamage();
        int power = getPower();
        int totalDamage = damage + power;
        System.out.println(otherWeapon.getName()+"副武器造成的伤害为："+(int)(totalDamage*0.5));
        }
    }
}
